#include "card.h"

Card::Card()
{

}

Card::Card(CardPoint point, CardSuit suit)
{
    setPoint(point);
    setSuit(suit);
}

Card::CardSuit Card::getsuit() const
{
    return m_suit;
}

void Card::setSuit(CardSuit newSuit)
{
    m_suit = newSuit;
}

Card::CardPoint Card::getpoint() const
{
    return m_point;
}

void Card::setPoint(CardPoint newPoint)
{
    m_point = newPoint;
}

bool lessSort(const Card &c1, const Card &c2)
{
    if(c1.getpoint() == c2.getpoint())
    {
        return c1.getsuit() < c2.getsuit();
    }
    else
    {
        return c1.getpoint() < c2.getpoint();
    }
}

bool greaterSort(const Card &c1, const Card &c2)
{
    if(c1.getpoint() == c2.getpoint())
    {
        return c1.getsuit() > c2.getsuit();
    }
    else
    {
        return c1.getpoint() > c2.getpoint();
    }
}
bool operator ==(const Card& left , const Card& right)
{
    return (left.getpoint() == right.getpoint() && left.getsuit() == right.getsuit());
}
uint qHash(const Card &card)
{
    return card.getpoint() * 100 +card.getsuit();
}

bool operator <(const Card& c1, const Card& c2)
{
    return lessSort(c1, c2);
}
